<tr>
    <?php foreach ($cols as $i => $col): ?>
        <?php $pager = isset($tab['pager']) ?>
        <?php $fpager = (isset($tab['fpager'])) ?>
    <th width="<?php echo $col['width'] ?>" class="ui-widget ui-state-default
<?php echo ($i == 0 ? " ui-corner-tl" : ($i == (count($cols)-1) ? " ui-corner-tr" : "")) ?> ui-allow-hover
<?php if ($pager || $fpager): ?> <?php echo ($tab['sort'] == $col['sort'] ? "ui-state-active" : "") ?><?php endif; ?>"
 <?php if (($pager || $fpager) && $col['sort'] != ""): ?>href="<?php echo $url_for ?>?<?php echo $get ?>=
<?php echo ($pager ? $tab['pager']->getPage() : 1) ?>&sort=<?php echo $col['sort'] ?>&order=
<?php echo ($tab['sort'] == $col['sort'] && $tab['order'] == "asc" ? "desc" : "asc" ) ?>" loc="<?php echo $tab['id'] ?>"<?php endif; ?>>
<?php echo $col['text']?><?php if (($pager || $fpager) && $col['sort'] != ""): ?> <span id="icon" class="
<?php echo ($tab['sort'] == $col['sort'] ? ( $tab['order'] == "asc" ? "ui-icon ui-icon-triangle-1-s" : "ui-icon ui-icon-triangle-1-n") : "ui-icon ui-icon-triangle-2-n-s") ?>
"></span><?php endif; ?></th>
    <?php endforeach; ?>
</tr>